import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    { path: '/login', component: () => import('@/views/login')},
    { path: '/register', component: () => import('@/views/register')},
    { path: '/article/:id', component: () => import('@/views/detail')},
    {
      path: '/',
      component: Layout,
      redirect: '/article',
      children: [
        { path: '/article', component: () => import('@/views/secondary/article')},
        { path: '/like', component: () => import('@/views/secondary/like')},
        { path: '/collect', component: () => import('@/views/secondary/collect')},
        { path: '/user', component: () => import('@/views/secondary/user')}
      ]
    }
  ]
})

export default router